package com.itlin.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MyBatis拦截器
 * @author 所谓伊人
 * @date 2022/3/21 - 20:59
 */
@Configuration
public class MybatisPlusConfig {

    @Bean
    public MybatisPlusInterceptor mpi() {

        // 1.Mybatis拦截器
        MybatisPlusInterceptor mpi = new MybatisPlusInterceptor();

        // 2.添加分页拦截器
        mpi.addInnerInterceptor(new PaginationInnerInterceptor());

        return mpi;
    }
}
